feat: add @pgsql/transform (SQL transformation, classification, qualification, closure) - #316
Merged
Merged
Conversation
…fication, closure)
Contributor
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
This was referenced Jul 27, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Step 2 of constructive-io/constructive-planning#1271 (follows #315, which freed the name): moves constructive-db's
transform-schemasinto this monorepo as the new@pgsql/transformat18.2.0(continuing the 18.x line).What moved (verbatim, minus path/doc tweaks):
transform.ts—transformSql: schema-name rewriting across DDL/DML/grants/policies/comments and inside PL/pgSQL bodies (hydrated viaplpgsql-parser)facts.ts—classifyStatements/StatementFacts: per-statement kind +creates/references/referencedSchemas/roles/fkTargets/securityRelevant/securityDefiner/dynamicSqlqualify.ts—qualifyUnqualified+ inventory helperscategorize.ts—CategoryProfile/TIER_PROFILE/buildCategoryOffixture-closure.ts—resolveFixtureClosuretransitive dependency closureround-trip-core.ts/round-trip.ts— dependency-freenormalizeTree/cleanTreeengine + mutation-aware round-trip validation__fixtures__golden files, and themake-fixtures/scan-corpus/hunt-plpgsql-bugsscriptsDeliberately not moved:
bundle-driver.ts(makeSchemaTranspiler/makeNamespaceValidator) — it depends on@pgpmjs/bundleand would invert layering; it relocates to the constructive repo in a follow-up.index.tsdrops only those exports; everything else is unchanged.Deps are all workspace-internal:
@pgsql/quotes,@pgsql/traverse,plpgsql-parser(published deps^18.xbecomeworkspace:*). Lockfile updated with a minimal hand-added importer block (fullpnpm installrewrites the file due to formatting drift;pnpm install --frozen-lockfileverified green with pnpm 9 / node 20 as in CI).Also: added
@pgsql/transformto the CI test matrix, and package tables inREADME.md/AGENTS.md. Package README notes the old version-upgrade transformer now lives at@pgsql/transform-ast.Verified locally: build + all 174 tests pass. Note:
pnpm lintfails repo-wide on main too (ESLint 9 installed with legacy.eslintrc.json) — pre-existing, untouched here.Follow-ups tracked in the planning issue: consume from constructive-db (delete
transform-schemas, relocatebundle-driver), and redo the pgpm slicer-closure prototype on this package.Link to Devin session: https://app.devin.ai/sessions/1aa52746e60c4df38ef2678d168269b9
Requested by: @pyramation